package com.ahwei.shop.auth.security.entity;

import com.ahwei.shop.auth.entity.User;
import lombok.Getter;
import org.springframework.security.core.GrantedAuthority;

import java.util.ArrayList;
import java.util.Collection;

/**
 * Author：ahWei
 * Email: ahwei163@qq.com
 * Date: 2022-05-19 17:20:17
 * Description: 这是一个Java文件！
 */
public class SecurityUser extends org.springframework.security.core.userdetails.User {

    /**
     * 当前登录用户明细
     */
    @Getter
    private User currentUser;

    public SecurityUser(User currentUser) {
        this(currentUser.getUsername(), currentUser.getPassword(), true, true, true, true,new ArrayList<>());
        this.currentUser = currentUser;
    }

    public SecurityUser(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
    }

}
